/**
 * 
 */
package fr.utbm.gi.vi51.slizers.framework.environment;

import java.util.Collection;

import org.janusproject.kernel.address.AgentAddress;

import fr.utbm.gi.vi51.slizers.framework.agent.AgentBody;
import fr.utbm.gi.vi51.slizers.framework.agent.SituatedAgent;

/**
 * Interface of an environment.
 * 
 * @author Tarik Belabbas
 * 
 */
public interface Environment
{
	/**
	 * Execute the behavior of the environment.
	 */
	public void run();

	/**
	 * Returns the width of the environment.
	 * 
	 * @return the width of the environment
	 */
	public int getWidth();

	/**
	 * Returns the height of the environment.
	 * 
	 * @return the height of the environment
	 */
	public int getHeight();

	/**
	 * Returns the agent bodies in the environment.
	 * 
	 * @return the agent bodies in the environment
	 */
	public Collection< AgentBody > getAgentBodies();

	/**
	 * Replies the agent body associated to the given agent.
	 * 
	 * @param _agentAddress the address of the agent
	 * @return the agent body associated to the agent
	 */
	public AgentBody getAgentBodyFor( AgentAddress _agentAddress );

	/**
	 * Add a listener on environment events.
	 * 
	 * @param _listener the listener on environment events
	 */
	public void addEnvironmentListener( EnvironmentListener _listener );

	/**
	 * Remove a listener on environment events.
	 * 
	 * @param _listener the listener on environment events
	 */
	public void removeEnvironmentListener( EnvironmentListener _listener );
	
	/**
	 * Spawn a body for the given agent.
	 * 
	 * @param _agent the agent for which a body must be spawned
	 */
	public void spawnAgentBody( SituatedAgent< ? > _agent );

	/**
	 * Remove the body of the given agent.
	 * 
	 * @param _agentAddress the address of the agent for which the body must be
	 *            removed
	 */
	public void killAgentBody( AgentAddress _agentAddress );
}
